package com.chinasofti.bufferedio;

import java.io.*;

public class Demo02 {
    public static void main(String[] args) throws IOException {
        //method01();
        method2();
        //return;
    }

    private static void method2() throws IOException {
        BufferedInputStream bis =
                new BufferedInputStream(new FileInputStream("E:\\aaa\\sp123.mp4"));
        BufferedOutputStream bos =
                new BufferedOutputStream(new FileOutputStream("java419\\sp123.mp4"));
        byte[] bys = new byte[1024];
        int len;
        while((len=bis.read(bys)) != -1){
            bos.write(bys,0,len);
        }
        bos.close();
        bis.close();
    }

    private static void method01() throws IOException {
        BufferedInputStream bis =
                new BufferedInputStream(new FileInputStream("E:\\aaa\\sp123.mp4"));
        BufferedOutputStream bos =
                new BufferedOutputStream(new FileOutputStream("java419\\sp123.mp4"));
        int by;
        while((by = bis.read()) != -1){
            bos.write(by);
        }
        bos.close();
        bis.close();
    }
}
